﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//using Microsoft.VisualStudio.TestTools.UnitTesting;

//using Pibby.Core.IO;
//using Pibby.Core.Models;
//using Pibby.Core.Presenters;

//namespace Pibby.Core.Tests
//{
//    [TestClass]
//    //[TestCategory ("Long Running")]
//    public class RssEpisodePresenterTests : IntegrationBaseTestFixture
//    {
//        private Stubs.RssEpisodesView _view;
//        private RssEpisodeModel _model;
//        private RssEpisodePresenter _presenter;

//        [TestInitialize]
//        public override void Setup()
//        {
//            base.Setup();

//            string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
//            IFolder folder = new Stubs.Folder(folderPath, 25, 0);

//            Podcast p = Stubs.PodcastFactory.GeneratePodcasts("mypodcast", 1)[0];

//            this.Repository.Put(p);

//            Stubs.RssFeedGenerator generator = new Stubs.RssFeedGenerator (10);
//            generator.PodcastTitle = p.Name;
//            generator.PodcastDescription = p.Description;

//            Stubs.DownloadingService.Downloads.Clear ();
//            Stubs.DownloadingService.Downloads.Add(p.FeedUrl, generator.Content);

//            this._view = new Stubs.RssEpisodesView();
//            this._model = new RssEpisodeModel(this.Repository, folder);
//            this._presenter = new RssEpisodePresenter(this._view, this._model, new Pibby.Core.Web.NetworkAuthentication());
//        }

//        [TestCleanup]
//        public override void TearDown()
//        {
//            base.TearDown();

//            this._presenter.UnsubscribeToClientEvents();
//        }

//        [TestMethod]
//        public void AtStartup_EmptyRepository_ModelAndViewLoadedCorrectly()
//        {
//            this._view.SimulateLoadEvent();

//            Assert.IsTrue(this._view.ShowEpisodesCalled);
//            Assert.AreEqual(this._model.Episodes.Count, this._view.EpisodesShown);
//        }

//        [TestMethod]
//        public void WhenRefreshed_EmptyRepository_NewEpisodesAreShown()
//        {
//            this._view.SimulateLoadEvent();

//            this._view.SimulateCheckForEpisodes();

//            //Assert.IsNotEmpty(this._model.DownloadableFeeds);

//            while (!this._view.RefreshFinishCalled)
//            {
//                System.Threading.Thread.Sleep(1000);
//            }

//            System.Threading.Thread.Sleep(1000);

//            Assert.AreEqual(1, this._view.ItemsRefreshed);
//            Assert.IsTrue(this._view.ShowEpisodesCalled);
//            Assert.AreEqual(this._model.Episodes.Count, this._view.EpisodesShown);
//        }
//    }
//}
